package struct.composite;

import java.util.Enumeration;
import java.util.Vector;

/**
 * Created by hmily on 2017/9/7.
 */
public class TreeNode {

    private String name;

    private TreeNode parent;

    private Vector<TreeNode> childs = new Vector<>();

    public TreeNode(String name) {
        this.name = name;
    }

    public void add(TreeNode treeNode){
        childs.add(treeNode);
    }

    public void remove(TreeNode treeNode){
        childs.remove(treeNode);
    }


    public Enumeration<TreeNode> getChilds(){
        return childs.elements();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public TreeNode getParent() {
        return parent;
    }

    public void setParent(TreeNode parent) {
        this.parent = parent;
    }

}
